$(function(){
  $('.card').on('click',function(){
    let card_move=$(this).offset().top-$(window).scrollTop()
    let card_move_instance=card_move *-1+'px'
    $(':root').css('--data-cardmove-top', card_move_instance)
    
    let card_expand_height=$(window).height()
    let count=480/420
    let imgHeight=$(this).find('img').outerHeight() * count
    let h2Height=$(this).find('h2').outerHeight() * count
    let container_height = card_expand_height - imgHeight - h2Height
    container_height /=count
    $(this).find('.container').css('height', container_height+'px')

    $(this).toggleClass('active')

    if($(this).hasClass('active')){
      $('body').addClass('noscroll')
    }else{
      $('body').removeClass('noscroll')
    }
  })
})